/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.gskorupa.univermon.auth;

import com.google.appengine.api.datastore.Key;
import java.util.HashSet;
import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.NotPersistent;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;

/**
 *
 * @author greg
 */
@PersistenceCapable
public class Client {
    
    @NotPersistent
    private String type="client";
    
    @Persistent
    private String uid;
    
    @Persistent
    private HashSet<String> devices;
    
    @Persistent
    private boolean confirmed;
    
    @PrimaryKey
    @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
    private Key key;
    public Client(){
        devices=new HashSet<String>();
    }

    /**
     * @return the uid
     */
    public String getUid() {
        return uid;
    }

    /**
     * @param uid the uid to set
     */
    public void setUid(String uid) {
        this.uid = uid;
    }

    /**
     * @return the devices
     */
    public HashSet getDevices() {
        return devices;
    }

    /**
     * @param devices the devices to set
     */
    public void setDevices(HashSet devices) {
        this.devices = devices;
    }
    
    public void addDevice(String devName){
        devices.add(devName);
    }
    
    public boolean isDevice(String devID){
        return devices.contains(devID);
    }

    /**
     * @return the confirmed
     */
    public boolean isConfirmed() {
        return confirmed;
    }

    /**
     * @param confirmed the confirmed to set
     */
    public void setConfirmed(boolean confirmed) {
        this.confirmed = confirmed;
    }
    
}
